package com.cet.designpatterns.prototype.浅拷贝;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-09-06 15:48
 **/
public class Client {
    public static void main(String[] args) {
        Sheep tom = new Sheep("tom", 1, "蓝色");
        Sheep jerry = new Sheep("jerry", 2, "棕色");
        tom.setFriend(jerry);
        System.out.println(jerry == tom.getFriend());
        Sheep cloneTom = (Sheep) tom.clone();
        System.out.println(jerry == cloneTom.getFriend());
        // 输出为true，说明引用属性的克隆时，仅仅是引用传递（内存地址副本） --浅拷贝
    }
}
